﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Common
{
    /// <summary>
    /// Класс "Статья"
    /// </summary>
   public class Articles: Item
    {
       public int ID { get; set; }
       /// <summary>
       /// Назва журнала до якого належить статья
       /// </summary>
       public string MagazineName { get; set; }
       /// <summary>
       /// Номер журнала до якого належить статья
       /// </summary>
       public int MagazineIssueNumber { get; set; }
       /// <summary>
       /// Автор
       /// </summary>
       public string AuthorName {get; set;}
       /// <summary>
       /// Версія
       /// </summary>
       public string Version {get; set;}

       Dictionary<string, string> ItemFields { get; set; }
       Dictionary<string, string> MagazineFields { get; set; }
       Dictionary<string, string> AuthorFields { get; set; }
       Dictionary<string, string> ArticlesFields { get; set; }

       public Articles() { }
       public Articles(string name, string publisher, DateTime publisherDate, string magazinename, int magazineissuenumber, string authorname, string version)
           : this(0, name, publisher, publisherDate,magazinename, magazineissuenumber, authorname, version) { }

       public Articles(int id ,string name, string publisher, DateTime publishedDate, string magazinename, int magazineissuenumber, string authorname, string version)
       {
           this.ID = id;
           this.Publisher = publisher;
           this.PublishedDate = publishedDate;
           this.MagazineName = magazinename;
           this.MagazineIssueNumber = magazineissuenumber;
           this.AuthorName = authorname;
           this.Version = version;


           ItemFields = new Dictionary<string, string>(3);
           ItemFields.Add("Name", Name);
           ItemFields.Add("Publisher", Publisher);
           ItemFields.Add("PublishedDate", PublishedDate.ToString());

           AuthorFields = new Dictionary<string, string>(1);
           AuthorFields.Add("Name", AuthorName);

           MagazineFields = new Dictionary<string, string>(2);
           MagazineFields.Add("MagazineName", magazinename);
           //MagazineFields.Add("MagazineIssueNumber", magazineissuenumber);

           ArticlesFields = new Dictionary<string, string>(1);
           ArticlesFields.Add("Version", version);
       }
    }
}
